﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace NNTH
{
    public partial class fGiaoVien : DevExpress.XtraEditors.XtraForm
    {
        public fGiaoVien()
        {
            InitializeComponent();
        }

        Data.QLTTNNTHEntities db = new Data.QLTTNNTHEntities();
        private void btnThem_Click(object sender, EventArgs e)
        {
            this.giaoVienBindingSource.AddNew();
        }

        private void btnXoa_Click(object sender, EventArgs e)
        {
            giaoVienBindingSource.RemoveCurrent();
        }

        private void btnLuu_Click(object sender, EventArgs e)
        {
            db.SaveChanges();
        }

        private void btnPrint_Click(object sender, EventArgs e)
        {

        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void fGiaoVien_Load(object sender, EventArgs e)
        {
            this.giaoVienBindingSource.DataSource = db.GiaoVien;
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (this.giaoVienBindingSource.Current != null)
            {
                var report = new Reports.reHopDong();
                BindingSource bs = (BindingSource)report.DataSource;
                bs.DataSource = this.giaoVienBindingSource.Current;
                report.ShowPreviewDialog();
            }
        }
    }
}